{% load bootstrap %}
<div class="control-group{% if field.errors %} error{% endif %} control-group-{{ field.html_name }} control-group-type-{{ field.name }}">
    {% if field|is_checkbox %}
        <div class="controls">
            <label class="checkbox">
                {{ field }} <span>{{ field.label }} {% if field.field.required %}*{% endif %}</span>
            </label>

            {% for error in field.errors %}
                <span class="help-inline">{{ error }}</span>
            {% endfor %}

            {% if field.help_text %}
            <p class="help-block">
                {{ field.help_text }}
            </p>
            {% endif %}
        </div>
    {% else %}
        {% if nolabel %}
        <div class="controls">
            {{ field }}

            {% for error in field.errors %}
                <span class="help-inline">{{ error }}</span>
            {% endfor %}

            {% if field.help_text %}
            <p class="help-block">
                {{ field.help_text }}
            </p>
            {% endif %}

        </div>
        {% else %}
        <label class="control-label">{{ field.label }} {% if field.field.required %}*{% endif %}</label>

        <div class="controls">
            {{ field }}

            {% for error in field.errors %}
                <span class="help-inline">{{ error }}</span>
            {% endfor %}

            {% if field.help_text %}
            <p class="help-block">
                {{ field.help_text }}
            </p>
            {% endif %}

        </div>
        {% endif %}
    {% endif %}
</div>
